const state = {
  user: {
    id: 0,
    name: 'aaa'
  },
  isLogin: false
}
const mutations = {
  setUser(state, payload) {
    state.user = payload
  },
  logout(state, payload) {
    state.isLogin = false
  },
  login(state, payload) {
    state.isLogin = true
  }
}

const actions = {

}

const getters = {
  user() {
    return state.isLogin ? state.user : {}
  },
  isLogin() {
    return state.isLogin
  },
  age() {
    return state.user.birth
  },
  sex() {
    return state.user.gender
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}
